<?php

	class Devmod_method_requireFields extends Devmod_methods_abstraction {
		
		protected $after_operation = array(array(
										'for_method' => 'save',
										'for_method_type' => 'add',
										'use' => 'verify'
									),array(
										'for_method' => 'save',
										'for_method_type' => 'frontend_add',
										'use' => 'verify'
									));
		
		public function set_config($args)
		{
			$this->update_config('require_fields', $args[0]);
		}
		
		public function verify($args)
		{
			if(!isset($this->config[$this->type]['require_fields'])) return $args;
			
			foreach($this->config[$this->type]['require_fields'] as $req_field)
			{
				if(empty($args[$req_field])) return false;
			}
			return $args;
		}
		
	}